package eliminate.view;

import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;

import eliminate.controller.MainFrame;

public class WindowDraggable extends MouseAdapter implements MouseMotionListener{
	private Point pressPoint;
	
	@Override
	public void mousePressed(MouseEvent e) {
		pressPoint = e.getPoint();
	}
	
	@Override
	public void mouseDragged(MouseEvent e) {
		Point p = MainFrame.getLocation();  
		Point point = new Point(p.x + e.getX() - (int)pressPoint.getX(), 
				p.y + e.getY() - (int)pressPoint.getY()); 
		
		MainFrame.setLocation(point);
	}
}
